$(function () {
    var _thisPage = null, _user = null, _html = [];

    var selectPage = function () {
        this.init();
    };
    selectPage.prototype = {
        init: function () {
            this.initData();
            this.bindEvent();
        },
        initData: function () {

        },
        bindEvent: function () {

            //商家报备
            $("#filing").on("tap", function () {
                redirect("filing.html");
                return false;
            });
            //商家签约
            $("#sign").on("tap", function () {
                redirect("sign.html");
                return false;
            });
            //回退
            $("#back").on("tap", function () {
                back();
            });
            //同意
            $("#aggreeSign").on("tap", function () {
                if (!$("#agreement").is(":checked")) {
                    $.toast("请选择同意协议");
                    return false;
                }

                $.ajax({
                    type: "POST",
                    url: CONFIG_MANAGER.RequstUrl + "v1/member/sign/agent/" + _user.id,
                    async: true,
                    headers: {"token": _user.token},
                    bbeforeSend: function () {
                        $.showWaiting("加载中");
                    }
                }).done(function (data) {
                    $.alert("签约成功", function () {
                        $("#singAgrementPop").hide();
                    });
                }).aways(function () {
                    $.closeWaiting();
                });
            });
        }
    };

    _thisPage = new selectPage();
});
